﻿import request from '@/utils/request'
import { getToken } from '@/utils/auth'  // 引入获取 token 的工具方法
// 发送文章评论
export function sendComment(type,articleId,rootId,toCommentId,toCommentUserId,content) {
    return request({
        url: '/comment',
        method: 'post',
        headers: {
            'Authorization': getToken()  // 将获取到的 token 添加到请求 header 中
        },
        data: {"articleId":articleId,"type":type,"rootId":rootId,"toCommentId":toCommentId,"toCommentUserId":toCommentUserId,"content":content}
    })
}


export function getArticleComment(query) {
    return request({
        url: '/comment/commentList',
        method: 'get',
        headers: {
          isToken: false
        },
        params: query
    })
}


export function getLinkComment(query) {
    return request({
        url: '/comment/linkCommentList',
        method: 'get',
        params: query
    })
}
export function getfriendsComment(query) {
    return request({
        url: '/comment/friendsCommentList',
        method: 'get',
        params: query
    })
}

//敏感词
export function getWord() {
    return request({
        url: '/comment/sensitive',
        method: 'get',
        
    })
}

//删除评论
export function deletemessage(id) {
    return request({
        url: '/comment/' + id,
        method: 'delete',
        
    })
}
export function getRegister() {
    return request({
        url: '/comment/register',
        method: 'get',
        
    })
}